<template>
  <div class="query-table-config">
    <el-tooltip class="config-item" effect="dark" content="刷新" placement="top">
     <span class="config-icon">
       <svg-icon icon-class="user" @click="onRefresh"></svg-icon>
     </span>
      <!--    <i class="el-icon-refresh-right" @click="onRefresh"></i>-->
    </el-tooltip>
    <el-tooltip class="config-item" effect="dark" content="密度" placement="top">
      <el-dropdown trigger="click" size="small" @command="onCommandChange">
       <span class="config-icon">
         <svg-icon icon-class="user"></svg-icon>
       </span>

        <el-dropdown-menu slot="dropdown" class="antvue-custom-drop-select">
          <el-dropdown-item command="">默认</el-dropdown-item>
          <el-dropdown-item command="medium">中等</el-dropdown-item>
          <el-dropdown-item command="small">紧凑</el-dropdown-item>
          <el-dropdown-item command="mini">迷你</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </el-tooltip>
    <el-tooltip class="config-item" effect="dark" content="设置" placement="top">
      <el-popover
          placement="bottom"
          width="300"
          trigger="click">
        <div>
          <el-button size="mini" @click="changeTableColumn"></el-button>
        </div>
        <span class="config-icon" slot="reference">
        <svg-icon icon-class="user"></svg-icon>
      </span>

      </el-popover>
    </el-tooltip>
  </div>
</template>

<script>
export default {
  name: "TableConfig",
  props: {
    column:{
      default: () => ([])
    }
  },
  data(){
    return {
      tableColumn: this.column
    }
  },
  methods: {
    onCommandChange(size) {
      this.$emit('sizeChange', size)
    },
    onRefresh() {
      this.$emit('refresh')
    },
    changeTableColumn() {
      this.tableColumn = this.tableColumn.reverse()
      this.$emit('columnChange', this.tableColumn)
    },
  }
}
</script>

<style lang="scss" scoped>
.query-table-config {
  width: 100%;
  max-width: 80px;
  margin-left: 24px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;

  .config-icon{
    color: #000;
    font-size: 16px;
  }
  .config-icon:hover{
    cursor: pointer;
    color: #127EFF;
  }
}
</style>